<?php
include dirname(dirname(dirname(__FILE__))).'/include/user-verify.php';
include dirname(__FILE__).'/functions.php';

$to_user_id = $_SESSION['user_id'];
$exchange_item = getExchangeByToUserId($to_user_id);
if($exchange_item==NULL) {
	echo 'invalid argument';
	exit();
}
$from_user_id = $exchange_item['from_user_id'];
$conn = get_db_conn();
$sql = 'update user set exchange_status = 0 where id = '.$to_user_id.';';
mysql_query($sql,$conn) or die("db error");
$sql = 'update user set exchange_status = 4 where id = '.$from_user_id.';';
mysql_query($sql,$conn) or die("db errror");

echo '<script>alert("你拒绝了对方的换班请求！");
		window.location="show-duty-table.php";</script>';